/*
 Simple example of making main thread exit and others to stay alive ! 
 */
#include <stdio.h> 
#include <string.h> 
#include <pthread.h>
#include <unistd.h>
#include <limits.h>

#define SLEEP_TIME 10

void * sleepy_thread(void *);


int main(int argc,char *argv[]){
  int error;
  pthread_t tid;
  

  if ((error = pthread_create(&tid, NULL, sleepy_thread, (void*)SLEEP_TIME)) != 0)
       fprintf(stderr, "Failed to create thread: %s\n", strerror(error));
  
  
  printf("Main thread exiting ...\n");
  pthread_exit((void *)0); 

  return 0;
}

void * sleepy_thread(void *arg){
  
  printf("Sleeping Thread ...\n");
  sleep((int)arg);
  printf("End of Sleep ...\n");

  return (void *)0;
}

